package com.liang.controller;


import com.liang.pojo.dto.Editor;
import com.liang.utils.tencentyun.TencentCOSUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.Objects;

@RestController
@RequestMapping("/Editor")
public class EditorController {

    @PostMapping("/pictureUpload")
    public Editor pictureUpload(MultipartFile file){

        String url = TencentCOSUtil.uploadfile(file);

        if(Objects.isNull(url)){
            return Editor.ErrorEditor("错误");
        }else{
            return Editor.OkEditor(url);
        }
    }
}
